﻿using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using System.Threading;
using System.Linq;

namespace ParallelTest
{
    class Program
    {
        static void Main(string[] args)
        {                          
            Console.WriteLine("Hello Parallel World!");
            Parallel.For(0,20, (i) =>
            {
                var tid = Thread.CurrentThread.ManagedThreadId;
                Console.WriteLine($"Current index: {i}, " +
                    $"ThreadId: {tid}");
            });
            Console.WriteLine("Run Finished!");
        }

        static void Func1()
        {
            for (int i = 0; i < 3; i++)
            {
                Task.Delay(888).Wait();
                Console.WriteLine($"Func1 Running");
            }
        }
        static void Func2()
        {
            for (int i = 0; i < 3; i++)
            {
                Task.Delay(666).Wait();
                Console.WriteLine($"Func2 Running");
            }
        }
    }
}
